package com.example.restaurantclient.Activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.restaurantclient.R;

public class AppointmentInfoActivity extends AppCompatActivity {
    private TextView text1;
    private TextView text2;
    private TextView appointmentInTime;
    private int maxNum=500;
    private TextView leftNum;
    private EditText ed;
    private ImageView cleanName;
    private ImageView cleanPhone;
    private EditText name,phone;
    private LinearLayout ll1;
    private LinearLayout ll2;
    private LinearLayout ll3;

    private TextView tt1;
    private TextView tt2;
    private TextView tt3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_appointment_info);
        text1=findViewById(R.id.text1);
        text2=findViewById(R.id.text1);
        cleanName=findViewById(R.id.clean_name);
        cleanPhone=findViewById(R.id.clean_phone);
        leftNum=findViewById(R.id.leftNum);
        ed=findViewById(R.id.nikeName);
        name=findViewById(R.id.appointment_name);
        phone=findViewById(R.id.appointment_phone);

        ll1=findViewById(R.id.ll1);
        ll2=findViewById(R.id.ll2);
        ll3=findViewById(R.id.ll3);
        tt1=findViewById(R.id.tt1);
        tt2=findViewById(R.id.tt2);
        tt3=findViewById(R.id.tt3);

        appointmentInTime=findViewById(R.id.appointment_in_time);
        text1.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC);
        text2.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC);
        appointmentInTime.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC);
        appointmentInTime.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                startActivity(new Intent(AppointmentInfoActivity.this,AppointmentSuccessActivity.class));

            }
        });
        ed.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }
            @Override
            public void afterTextChanged(Editable s) {
                leftNum.setText(s.length()+"");
            }
        });
        cleanPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                phone.getText().clear();
            }
        });
        cleanName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                name.getText().clear();
            }
        });

        ll1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ll1.setBackgroundColor(getResources().getColor(R.color.mainColor));
                tt1.setTextColor(getResources().getColor(R.color.white));
            }
        });

        ll2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ll2.setBackgroundColor(getResources().getColor(R.color.mainColor));
                tt2.setTextColor(getResources().getColor(R.color.white));
            }
        });

        ll3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ll3.setBackgroundColor(getResources().getColor(R.color.mainColor));
                tt3.setTextColor(getResources().getColor(R.color.white));
            }
        });



    }
}
